package com.central.controller;

import com.central.log.annotation.AuditLog;
import com.central.log.monitor.PointUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * 测试log组件
 * @author: ly
 * @date: 2020/11/13 2:53 下午
 * @email: 664162337@qq.com
 */
@RestController
public class LogDemoController {

    @Autowired
    private JdbcTemplate jdbcTemplate;

    /**
     * 测试日志
     * @param name 参数
     * @return
     */
    @GetMapping("/log/{name}")
    @AuditLog(operation = "'记录日志:' + #name")
    public String log(@PathVariable String name) {
        // 同步测试自定义埋点
        PointUtil.info("id", "type", "message");
        return "hello :" + name;
    }

}
